<template>
  <transition name="fade">
    <div v-show="detailShow" class="detail" transition="fade">
      <div class="detail-wrapper clearFix" @click="toggle">
        <div class="detail-main">
          <h1 class="name">{{shop.name}}</h1>
          <div class="star-wrapper">
            <v-star :size="48" :score="shop.score"></v-star>
          </div>
          <div class="title">
            <div class="line"></div>
            <div class="text">优惠信息</div>
            <div class="line"></div>
          </div>
          <ul v-if="shop.supports" class="supports">
            <li v-for="item in shop.supports" class="supports-item">
              <v-icon :iconType="classMap[item.type]"></v-icon>
              <span class="text">{{item.description}}</span>
            </li>
          </ul>
          <div class="title">
            <div class="line"></div>
            <div class="text">商家公告</div>
            <div class="line"></div>
          </div>
          <div class="bulletin">
            <p class="content">{{shop.bulletin}}</p>
          </div>
        </div>
      </div>
      <div class="detail-close">
        <i class="fa fa-times" @click="toggle"></i>
      </div>
    </div>
  </transition>
</template>

<script type="text/ecmascript-6">
  import star from '@/components/star/star.vue';
  import icon from '@/components/customIcon/customIcon.vue';
  import {mapGetters} from 'vuex';

  export default {
    data() {
      return {detailShow: false};
    },
    name: 'shopdetail',
    components: {'v-star': star, 'v-icon': icon},
    created() {
      this.classMap = ['decrease', 'discount', 'special', 'invoice', 'guarantee'];
    },
    computed: {
      ...mapGetters({
        shop: 'selectedShop'
      })
    },
    methods: {
      toggle() {
        this.detailShow = !this.detailShow;
      }
    }
  };
</script>

<style lang="stylus" rel="stylesheet/stylus">
  @import '../../../../common/stylus/mixin.styl'
  .detail
    position fixed
    z-index 100
    top 0
    right 0
    width 100%
    height 100%
    overflow auto
    background rgba(7, 17, 27, 0.8)
    -webkit-backdrop-filter blur(10px) /* &.fade-enter-active
      animation: bounce-in .5s;
    &.fade-leave-active
      animation: bounce-out .5s;
    @keyframes bounce-in {
      0% {
        transform: scale(0);
      }
      50% {
        transform: scale(1.5);
      }
      100% {
        transform: scale(1);
      }
    }
    @keyframes bounce-out {
      0% {
        transform: scale(1);
      }
      50% {
        transform: scale(1.5);
      }
      100% {
        transform: scale(0);
      }
    }*/
    &.fade-enter-active, &.fade-leave-active
      transition: all 1s
    &.fade-enter, &.fade-leave-active
      opacity 0
    .detail-wrapper
      width 100%
      z-index 100
      min-height 100%
      .detail-main
        margin-top 64px
        padding-bottom 64px
        .name
          line-height 16px
          text-align center
          font-size 16px
          font-weight 700px
        .star-wrapper
          text-align center
          margin-top 16px
        .title
          width 80%
          margin 28px auto 24px auto
          display flex
          flex-flow row nowrap
          justify-content space-between
          align-items center
          .text
            flex 0 0 auto
            padding 12px
            font-weight 700
          .line
            flex 1 1 auto
            border-bottom: 1px solid rgba(255, 255, 255, 0.2)
        .supports
          width 80%
          margin 22px auto
          .supports-item
            padding 0 12px
            font-size 0px
            margin-bottom 12px
            &:last-child
              margin-bottom 0px
            .text
              line-height 12px
              font-size 12px
        .bulletin
          width 80%
          height 200px
          margin 22px auto
          .content
            padding 0 12px
            font-weight 200
            line-height 24px
            font-size 12px
    .detail-close
      position relative
      width 32px
      height 32px
      margin -64px auto 0 auto
      clear both
      font-size 32px
</style>
